package com.demo.operators;

import com.demo.controllers.RedisClusterController;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.javaoperatorsdk.operator.Operator;
import io.javaoperatorsdk.operator.config.runtime.DefaultConfigurationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RedisClusterOperator {
    private static final Logger log = LoggerFactory.getLogger(RedisClusterOperator.class);

    public static void main(String[] args) {

        Config config = new ConfigBuilder().withNamespace(null).build();
        KubernetesClient client = new DefaultKubernetesClient(config);
        Operator operator = new Operator(client, DefaultConfigurationService.instance());
        //注册controllers
        operator.register(new RedisClusterController(client));
        log.info("Start happened");
    }
}
